package com.example.helloworld;

import java.util.ArrayList;
import java.util.Collections;

import com.example.helloworld.tools.Tools;

public class ItemSection implements Item {
	
	private long id;
	private String title;
	
	private ArrayList<ItemObject> nativeItemObjects = new ArrayList<ItemObject>();
	
	public ItemSection() {
		
	}

	public ItemSection(String title) {
		this.title = title;
	}
	
	public ItemSection(String title, long id) {
		this(title);
		this.id = id;
	}

	public ArrayList<ItemObject> getNativeItemObjects() {
		return nativeItemObjects;
	}

	public void setNativeItemObjects(ArrayList<ItemObject> nativeItemObjects) {
		this.nativeItemObjects = nativeItemObjects;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public void addNativeItemObject(ItemObject item) {
		nativeItemObjects.add(item);
	}
	
	public void sortNativeItemObjectsBy(int by) {
		//TODO
		switch(by){
		case Tools.ItemObjectSort.TITLE: Collections.sort(nativeItemObjects, new Tools.Comparators.ComparatorTitle()); break;
		case Tools.ItemObjectSort.PRICE: Collections.sort(nativeItemObjects, new Tools.Comparators.ComparatorPrice()); break;
		case Tools.ItemObjectSort.STATUS: Collections.sort(nativeItemObjects, new Tools.Comparators.ComparatorStatus()); break;
		}
		
		
	}
	
}
